package ${packagePath };

import java.io.Serializable;

<#assign i = 1>
<#list entityProList as prop>
<#if prop.type == 'Timestamp' && i == 1>
import java.sql.*;
<#assign i = i + 1>
</#if>
</#list>

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Table;

import javax.validation.constraints.Digits;

<#assign j = 1>
<#list entityProList as prop>
<#if prop.type?index_of('email') != -1 && j == 1>
import org.hibernate.validator.constraints.Email;
<#assign j = j + 1>
</#if>
</#list>
import org.hibernate.validator.constraints.Length;
import org.hibernate.validator.constraints.NotBlank;

/**
 * ${entityName }实体类
 * 
 * @author <a href="mailto:java_lht@163.com">Lht</a>
 * @since ${date }
 * @version 1.0
 */
@Entity
@Table(name = "${tableName }")
public class ${entityName } implements Serializable {
	
<#list entityProList as prop>
<#if prop.key?? && prop.key=='PRI'>
	@Id
	@GeneratedValue(strategy = GenerationType.AUTO)
</#if>
	@Column(name = "${prop.name }")
<#if !prop.propertyIsNull && prop.key != 'PRI'>
	@NotBlank(message="不可为空")
</#if>
<#if prop.type == 'String' && prop.stringMaxSize?? && prop.key != 'PRI'>
	<#if prop.type?index_of('email')!=-1>
	@Email
	</#if>
	@Length(max = ${prop.stringMaxSize }, message = "长度必须小于或等于${prop.stringMaxSize }字节")
</#if>
<#if (prop.type == 'int' || prop.type == 'long' || prop.type == 'double') && prop.integerMaxSize?? && prop.fractionMaxSize?? && prop.key != 'PRI'>
	@Digits(integer = ${prop.integerMaxSize }, fraction = ${prop.fractionMaxSize }, message="数字精度超出范围")
</#if>
<#if (prop.type=='double') && prop.integerMaxSize?? && prop.fractionMaxSize?? && prop.key != 'PRI'>
	@Digits(integer = ${prop.integerMaxSize }, fraction = ${prop.fractionMaxSize }, message="数字精度超出范围")
</#if>
	private ${prop.type } ${prop.name?uncap_first };		//${prop.comment }
	
</#list>
	<#-- 
	public ${entityName }() {
		super();
	}

	public ${entityName }(<#list entityProList as prop>${prop.type } ${prop.name?uncap_first }, </#list>) {
		super();
	<#list entityProList as prop>
		this.${prop.name?uncap_first } = ${prop.name?uncap_first };
	</#list>
	}
	-->
	
<#list entityProList as prop>
	public ${prop.type } get${prop.name }() {
		return ${prop.name?uncap_first };
	}

	public void set${prop.name }(${prop.type } ${prop.name?uncap_first }) {
		this.${prop.name?uncap_first } = ${prop.name?uncap_first };
	}
	
</#list>
}